import request from '@/utils/request'

// 顾客查看帖子详细信息
export function getPostById(id){
  return request({
    url: '/web/post/getPostById/'+id,
    method: 'get',

  })
}

// 顾客新增帖子
export function addNewPost(data) {
  return request({
    url: '/web/post/addPost',
    method: 'post',
    data:data
  })
}

//顾客查询帖子
export function getPostList() {
  return request({
    url: '/web/post/getPostList',
    method: 'get',
  })
}

export function searchPost(query) {
  return request({
    url: '/web/post/searchPost',
    method: 'get',
    params: {
      postTitle:query
    }
  })
}
export function addPostReadCount(query) {
  return request({
    url: '/web/post/addReadCount',
    method: 'get',
    params: {
      postId:query
    }
  })
}
//根据作者id查看帖子
export function searchPostByCustomerId(query) {
  return request({
    url: '/web/post/searchPostByCustomerId',
    method: 'get',
    params: {
      customerId:query
    }
  })
}





// 查询帖子管理列表
export function listPost(query) {
  return request({
    url: '/web/post/list',
    method: 'get',
    params: query
  })
}

// 查询帖子管理详细
export function getPost(postId) {
  return request({
    url: '/web/post/' + postId,
    method: 'get'
  })
}

// 新增帖子管理
export function addPost(data) {
  return request({
    url: '/web/post',
    method: 'post',
    data: data
  })
}

// 修改帖子管理
export function updatePost(data) {
  return request({
    url: '/web/post',
    method: 'put',
    data: data
  })
}

// 删除帖子管理
export function delPost(postId) {
  return request({
    url: '/web/post/' + postId,
    method: 'delete'
  })
}
